<?php
/**
 * Created by PhpStorm.
 * User: Shroom Ari
 * Date: 11/20/14
 * Time: 11:26 AM
 */
class Musergroup extends MY_Model{
    public $table = 'usergroup';
    function get_usergroup_information($id){
        $this-> db -> select('*');
        $this-> db -> from('usergroup');
        $this-> db -> where('usergroup_id', $id);
        $this-> db -> limit(1);
        $query = $this -> db -> get();
        if($query -> num_rows() == 1)
        {
            return $query->result();
        }
        else
        {
            return false;
        }
    }


    function getUserGroup($perpage,$offset){

        $query = $this->db->get('usergroup',$perpage,$offset);
        return $query->result_array();
    }
    function getUserGroupById($id){
        $this->db->select('*');
        $this->db->from('usergroup');
        $this->db->where('usergroup_id',$id);
        $this->db->limit(1);
        $query = $this->db->get();
        return $query->result_array();
    }
    function countAll(){
        return $this->db->count_all('usergroup');
    }
    function delete($id){
        $this->db->where('usergroup_id',$id);
        $this->db->delete('usergroup');
    }
    function updateUserGroup($id,$dt){
        $this->db->where('usergroup_id',$id);
        if ($this->db->update('usergroup',$dt))
            return TRUE;
        else return FALSE;
    }

}
